import { getStoreId } from '@/utils'
import request from '@/utils/request'
import querystring from 'querystring'

/**
 * 非编辑查看详情接口
 */
export function getSubscribeById(id) {
  return request.get(`/subscribe/detail/${id}`)
}
/**
 * 预约延期
 * @param {*} param 
 */
export function subscribePostpone(param) {
  return request.put(`/subscribe/postpone`,param)
}
/**
 * 预约新增接口
 * @param {*} param 
 */
export function addSubscribe(param) {
  return request.post('/subscribe/save', param)
}
/**
 * 预约编辑接口
 * @param {*} param 
 */
export function editSubscribe(param) {
  return request.put('/subscribe/save', param)
}
export function deleteSubscribe(id) {
  return request.delete(`/subscribe/del/${id}`)
}
/**
 * 生成预约编号
 */
export function getSubscribeCode() {
  return request.get(`/subscribe/getSubscribeCode/${getStoreId()}`)
}
/**
 * 预约管理分页查询
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function subscribeList(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post('/subscribe/page', data)
}

/**
 * 编辑详情
 * @param {*} id 
 * @param {*} param 
 */
export function editSubscribeById(id, param) {
  return request.get(`/subscribe/findById/${id}`, param)
}

/**
 * 预约确认
 * @param {*} param 
 */
export function affirmSubscribe(param) {
  return request.get(`/subscribe/affirm/${param.id}/${param.status}`)
}

/**
 * 预约取消
 * @param {*} param 
 */
export function cancelSubscribe(param) {
  return request.get(`/subscribe/cancel/${param.id}/${param.status}`)
}

export function dayBoardSubscribe(param) {
  return request.put('/subscribe/dayBoard', param)
}


export function postphoneSubscribe(param) {
  return request.put(`/subscribe/postphone`, param)
}

/**
 * 预约转工单get
 * @param {*} id 
 */
export function turnWorkOrderSubscribe(id) {
  return request.get(`/subscribe/turnWorkOrder/${id}`)
}

/**
 * 预约看板-周
 * @param {*} param 
 */
export function subscribeBoardWeekBoard(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post(`/subscribeBoard/weekBoard`, data)
}
/**
 * 预约看板查看天
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function subscribeBoardDayBoard(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post(`/subscribeBoard/dayBoard`, data)
}
/**
 * 预约看板-查看天详情
 * @param {*} param 
 * @param {*} pageSize 
 * @param {*} pageNo 
 */
export function subscribeBoardDayDetailBoard(param, pageSize, pageNo) {
  const data = {
    pageNo,
    pageSize,
    param: {
      ...param
    }
  }
  return request.post(`/subscribeBoard/dayDetailBoard`, data)
}

